<!--Copyright (C) Kherty.  All rights reserved.-->
<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ssui="clr-namespace:OpenLS.Spreadsheet.UI" xmlns:UI="clr-namespace:OpenLS.UI;assembly=OpenLS.UI">
    <ResourceDictionary.MergedDictionaries>
        <ssui:Spreadsheet2007BlueSkin></ssui:Spreadsheet2007BlueSkin>
    </ResourceDictionary.MergedDictionaries>

        <Style TargetType="{x:Type ssui:WorkbookControl}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ssui:WorkbookControl}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        <Border.Resources>
                            <ResourceDictionary>
                                <ResourceDictionary.MergedDictionaries>
                                    <ssui:WorkbookResources />

                                </ResourceDictionary.MergedDictionaries>
                            </ResourceDictionary>
                        </Border.Resources>
                        <ContentPresenter Content="{TemplateBinding Workbook}"></ContentPresenter>

                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type ssui:DimensionsControl}">
    </Style> 
    
    <Style x:Key="rowsColumnsControl">
        <Setter Property="Panel.ZIndex" Value="1" />
    	<Setter Property="TextElement.FontSize" Value="14" />
        <Setter Property="Control.SnapsToDevicePixels" Value="True"></Setter>
    </Style>

    <Style TargetType="{x:Type ssui:RowsControl}" BasedOn="{StaticResource rowsColumnsControl}">
<!--        <Setter Property="ContextMenu">
            <Setter.Value>
                <ContextMenu UI:RibbonElement.ControlState="Medium">
                    <MenuItem Command="{x:Static ApplicationCommands.Cut}" CommandParameter="{Binding}"/>
                    <MenuItem Command="{x:Static ApplicationCommands.Copy}" CommandParameter="{Binding}"/>
                    <MenuItem Command="{x:Static ApplicationCommands.Paste}" CommandParameter="{Binding}"/>
                    <MenuItem Command="{x:Static ssui:ClipboardCommands.PasteSpecial}" CommandParameter="{Binding}"/>
                    <Separator/>
                    <MenuItem Command ="{x:Static ssui:SpreadsheetCommands.InsertRow}" CommandParameter="{Binding}"/>
                    <MenuItem Command ="{x:Static ssui:SpreadsheetCommands.DeleteRows}" CommandParameter="{Binding}"/>
                    <MenuItem Command ="{x:Static ssui:SpreadsheetEditingCommands.ClearContents}" CommandParameter="{Binding}"/>
                    <Separator/>
                    <MenuItem Command ="{x:Static ssui:SpreadsheetCommands.FormatCells}" CommandParameter="{Binding}"/>
                    <MenuItem Command ="{x:Static ssui:SpreadsheetCommands.SetRowHeight}" CommandParameter="{Binding}"/>
                    <MenuItem Command ="{x:Static ssui:SpreadsheetCommands.HideRows}" CommandParameter="{Binding}"/>
                    <MenuItem Command ="{x:Static ssui:SpreadsheetCommands.UnhideRows}" CommandParameter="{Binding}"/>
                </ContextMenu>

            </Setter.Value>
        </Setter> -->
        <Setter Property="Selection" Value="{Binding Worksheet.Selection}"></Setter>
        <Setter Property="Background" Value="{DynamicResource {x:Static ssui:SpreadsheetBrushes.RowBackgroundKey}}"/>
        <Setter Property="Foreground" Value="{DynamicResource {x:Static UI:OfficeBrushes.TextForegroundKey}}"/>
        <Setter Property="ItemBorderBrush" Value="{DynamicResource {x:Static ssui:SpreadsheetBrushes.RowBorderBrushKey}}"/>

        <Setter Property="ItemHoverBackground" Value="{DynamicResource {x:Static ssui:SpreadsheetBrushes.RowHoverBackgroundKey}}"></Setter>
        <Setter Property="ItemHoverBorderBrush" Value="{DynamicResource {x:Static ssui:SpreadsheetBrushes.RowLightBorderBrushKey}}"></Setter>
        <Setter Property="ItemHoverForeground" Value="{DynamicResource {x:Static UI:OfficeBrushes.TextForegroundKey}}"></Setter>

        <Setter Property="ItemHoverSelectedBackground" Value="{DynamicResource {x:Static ssui:SpreadsheetBrushes.RowSelectedHoverBackgroundKey}}"></Setter>
        <Setter Property="ItemHoverSelectedBorderBrush" Value="{DynamicResource {x:Static ssui:SpreadsheetBrushes.RowSelectedBorderBrushKey}}"></Setter>

        <Setter Property="ItemSelectedBackground" Value="{DynamicResource {x:Static ssui:SpreadsheetBrushes.RowSelectedBackgroundKey}}"></Setter>
        <Setter Property="ItemSelectedBorderBrush" Value="{DynamicResource {x:Static ssui:SpreadsheetBrushes.RowSelectedBorderBrushKey}}"></Setter>

        <Setter Property="ItemFullSelectedBackground" Value="{DynamicResource {x:Static ssui:SpreadsheetBrushes.RowFullSelectedBackgroundKey}}"></Setter>
        <Setter Property="ItemSelectedBorderBrush" Value="{DynamicResource {x:Static ssui:SpreadsheetBrushes.RowSelectedBorderBrushKey}}"></Setter>

        <Setter Property="Fragment" Value="{Binding}"></Setter>
        <Setter Property="ItemsSource" Value="{Binding Rows}"></Setter>
        <Setter Property="ItemSelectedForeground" Value="{DynamicResource {x:Static UI:OfficeBrushes.TextForegroundKey}}"></Setter>
        <Style.Triggers>
            <DataTrigger Binding="{Binding Worksheet.View.RowColumnHeadersVisible}"  Value="False">
                <Setter Property="Visibility" Value="Collapsed"></Setter>
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <Style TargetType="{x:Type ssui:ColumnsControl}" BasedOn="{StaticResource rowsColumnsControl}">
<!--        <Setter Property="ContextMenu">
            <Setter.Value>
                    <ContextMenu UI:RibbonElement.ControlState="Medium">
                        <MenuItem Command="{x:Static ApplicationCommands.Cut}" CommandParameter="{Binding}"/>
                        <MenuItem Command="{x:Static ApplicationCommands.Copy}" CommandParameter="{Binding}"/>
                        <MenuItem Command="{x:Static ApplicationCommands.Paste}" CommandParameter="{Binding}"/>
                        <MenuItem Command="{x:Static ssui:ClipboardCommands.PasteSpecial}" CommandParameter="{Binding}"/>
                        <Separator/>
                        <MenuItem Command ="{x:Static ssui:SpreadsheetCommands.InsertColumn}" />
                        <MenuItem Command ="{x:Static ssui:SpreadsheetCommands.DeleteColumns}" CommandParameter="{Binding}"/>
                        <MenuItem Command ="{x:Static ssui:SpreadsheetEditingCommands.ClearContents}" CommandParameter="{Binding}"/>
                        <Separator/>
                        <MenuItem Command ="{x:Static ssui:SpreadsheetCommands.FormatCells}" CommandParameter="{Binding}"/>
                        <MenuItem Command ="{x:Static ssui:SpreadsheetCommands.SetColumnWidth}" CommandParameter="{Binding}"/>
                        <MenuItem Command ="{x:Static ssui:SpreadsheetCommands.HideColumns}" CommandParameter="{Binding}"/>
                        <MenuItem Command ="{x:Static ssui:SpreadsheetCommands.UnhideColumns}" CommandParameter="{Binding}"/>
                    </ContextMenu>
            </Setter.Value>
        </Setter> -->
        <Setter Property="Selection" Value="{Binding Worksheet.Selection}"></Setter>
        <Setter Property="Background" Value="{DynamicResource {x:Static ssui:SpreadsheetBrushes.ColumnBackgroundKey}}"/>
        <Setter Property="Foreground" Value="{DynamicResource {x:Static UI:OfficeBrushes.TextForegroundKey}}"/>
        <Setter Property="ItemBorderBrush" Value="{DynamicResource {x:Static ssui:SpreadsheetBrushes.ColumnBorderBrushKey}}"></Setter>

        <Setter Property="ItemHoverBackground" Value="{DynamicResource {x:Static ssui:SpreadsheetBrushes.ColumnHoverBackgroundKey}}"></Setter>
        <Setter Property="ItemHoverBorderBrush" Value="{DynamicResource {x:Static ssui:SpreadsheetBrushes.ColumnLightBorderBrushKey}}"></Setter>
        <Setter Property="ItemHoverForeground" Value="{DynamicResource {x:Static ssui:SpreadsheetBrushes.ColumnLightBorderBrushKey}}"></Setter>

        <Setter Property="ItemHoverSelectedBackground" Value="{DynamicResource {x:Static ssui:SpreadsheetBrushes.ColumnSelectedHoverBackgroundKey}}"></Setter>
        <Setter Property="ItemHoverSelectedBorderBrush" Value="{DynamicResource {x:Static ssui:SpreadsheetBrushes.ColumnSelectedBorderBrushKey}}"></Setter>


        <Setter Property="ItemSelectedBackground" Value="{DynamicResource {x:Static ssui:SpreadsheetBrushes.ColumnSelectedBackgroundKey}}"></Setter>
        <Setter Property="ItemSelectedBorderBrush" Value="{DynamicResource {x:Static ssui:SpreadsheetBrushes.ColumnSelectedBorderBrushKey}}"></Setter>
        <Setter Property="ItemSelectedForeground" Value="{DynamicResource {x:Static UI:OfficeBrushes.TextForegroundKey}}"></Setter>

        <Setter Property="ItemFullSelectedBackground" Value="{DynamicResource {x:Static ssui:SpreadsheetBrushes.ColumnFullSelectedBackgroundKey}}"></Setter>
        <Setter Property="ItemSelectedBorderBrush" Value="{DynamicResource {x:Static ssui:SpreadsheetBrushes.ColumnSelectedBorderBrushKey}}"></Setter>

        <Setter Property="Fragment" Value="{Binding}"></Setter>
        <Setter Property="ItemsSource" Value="{Binding Columns}"></Setter>
        <Style.Triggers>
            <DataTrigger Binding="{Binding Worksheet.View.RowColumnHeadersVisible}"  Value="False">
                <Setter Property="Visibility" Value="Collapsed"></Setter>
            </DataTrigger>
        </Style.Triggers>
    </Style>
</ResourceDictionary>
